package com.aspose.cells;

import java.util.ArrayList;
import java.util.Collections;

class zacp {
   private int a = 0;
   private float b = 0.0F;
   private zact c = new zact();
   private int d = 4;

   public int a() {
      return this.a;
   }

   public void a(int var1) {
      this.a = var1;
   }

   public float b() {
      return this.b;
   }

   public void a(float var1) {
      this.b = var1;
   }

   public zact c() {
      return this.c;
   }

   public int d() {
      return this.d;
   }

   public void b(int var1) {
      this.d = var1;
   }

   private static Color a(zvm var0, float var1, float var2) {
      Color var3 = var0.c().a().c().a(0).a();
      float var4 = (float)(var3.getA() & 255);
      float var5 = (float)((var3.getR() & 255) + (int)var2);
      var5 = Math.max(0.0F, Math.min(var5, 255.0F)) * var1;
      float var6 = (float)((var3.getG() & 255) + (int)var2);
      var6 = Math.max(0.0F, Math.min(var6, 255.0F)) * var1;
      float var7 = (float)((var3.getB() & 255) + (int)var2);
      var7 = Math.max(0.0F, Math.min(var7, 255.0F)) * var1;
      return Color.fromArgb((int)var4, (int)var5, (int)var6, (int)var7);
   }

   com.aspose.cells.b.a.b.zc a(zvm var1, com.aspose.cells.b.a.b.a.ze var2, float var3, float var4) {
      com.aspose.cells.b.a.b.zq var5 = com.aspose.cells.a.c.zn.a(var2);
      return var5.h() > 0.0F && var5.i() > 0.0F ? new com.aspose.cells.b.a.b.zu(a(var1, var3, var4)) : new com.aspose.cells.b.a.b.zu(Color.getEmpty());
   }

   com.aspose.cells.b.a.b.zc a(com.aspose.cells.b.a.b.a.ze var1, com.aspose.cells.b.a.b.zm var2, boolean var3, float var4) {
      if (var2 != null) {
         var1.a(var2);
      }

      com.aspose.cells.b.a.b.zq var5 = com.aspose.cells.a.c.zn.a(var1);
      if (var5.h() > 0.0F && var5.i() > 0.0F) {
         com.aspose.cells.b.a.b.a.zc var6 = this.b(var4);
         if (this.a() == 0) {
            com.aspose.cells.b.a.b.a.zh var10 = new com.aspose.cells.b.a.b.a.zh(var5, Color.getRed(), Color.getGreen(), this.b());
            if (var6 != null) {
               var10.a(var6);
            }

            return var10;
         } else {
            com.aspose.cells.b.a.b.a.zk var8;
            com.aspose.cells.b.a.b.a.ze var9;
            if (this.a() == 1) {
               var9 = this.a(var5);
               var8 = new com.aspose.cells.b.a.b.a.zk(var9, 1);
               if (var6 != null) {
                  var8.a(var6);
               }

               return var8;
            } else if (this.a() == 2) {
               var9 = this.a(var5);
               var8 = new com.aspose.cells.b.a.b.a.zk(var9, 2);
               if (var6 != null) {
                  var8.a(var6);
               }

               return var8;
            } else {
               com.aspose.cells.b.a.b.a.zk var7 = new com.aspose.cells.b.a.b.a.zk(var1, 3);
               if (var6 != null) {
                  var7.a(var6);
               }

               return var7;
            }
         }
      } else {
         return new com.aspose.cells.b.a.b.zu(Color.getEmpty());
      }
   }

   private com.aspose.cells.b.a.b.a.zc b(float var1) {
      if (this.c.getCount() == 0) {
         return null;
      } else {
         ArrayList var2 = new ArrayList();

         for(int var3 = 0; var3 < this.c.getCount(); ++var3) {
            com.aspose.cells.b.a.a.ze.a(var2, (Object)this.c.a(var3));
         }

         zacw var14 = new zacw();
         Collections.sort(var2, var14);
         int var4 = var2.size();
         ArrayList var5 = new ArrayList();
         ArrayList var6 = new ArrayList();

         for(int var7 = 0; var7 < var4; ++var7) {
            zacy var8 = (zacy)var2.get(var7);
            Color var9 = Color.fromArgb(var8.a().getA() & 255, (int)((float)(var8.a().getR() & 255) * var1), (int)((float)(var8.a().getG() & 255) * var1), (int)((float)(var8.a().getB() & 255) * var1));
            float var10 = var8.b() / 100.0F;
            com.aspose.cells.b.a.a.ze.a(var5, (Object)var9);
            com.aspose.cells.b.a.a.ze.a(var6, (Object)var10);
            if (var7 == 0 && var10 != 0.0F) {
               var5.add(0, var9);
               var6.add(0, 0);
            }

            if (var7 == var4 - 1 && var10 != 1.0F) {
               com.aspose.cells.b.a.a.ze.a(var5, (Object)var9);
               com.aspose.cells.b.a.a.ze.a(var6, (Object)1);
            }
         }

         Color[] var15 = new Color[var5.size()];
         float[] var16 = new float[var6.size()];
         boolean var17 = this.a() != 0;

         for(int var18 = 0; var18 < var5.size(); ++var18) {
            int var11 = var18;
            if (var17) {
               var11 = var5.size() - 1 - var18;
            }

            Color var12 = (Color)var5.get(var11);
            float var13 = (float)com.aspose.cells.b.a.ze.g(var6.get(var11));
            var13 = var17 ? 1.0F - var13 : var13;
            var15[var18] = var12;
            var16[var18] = var13;
         }

         com.aspose.cells.b.a.b.a.zc var19 = new com.aspose.cells.b.a.b.a.zc();
         var19.a(var15);
         var19.a(var16);
         return var19;
      }
   }

   private com.aspose.cells.b.a.b.a.ze a(com.aspose.cells.b.a.b.zq var1) {
      com.aspose.cells.b.a.b.a.ze var2 = new com.aspose.cells.b.a.b.a.ze();
      if (this.d() == 4) {
         if (this.a() == 1) {
            var2.b(var1);
         } else {
            float var3 = (float)Math.sqrt((double)(var1.h() / 2.0F * var1.h() / 2.0F + var1.i() / 2.0F * var1.i() / 2.0F));
            com.aspose.cells.b.a.b.zo var4 = new com.aspose.cells.b.a.b.zo(var1.j() + var1.h() / 2.0F, var1.k() + var1.i() / 2.0F);
            var2.a(var4.d() - var3, var4.e() - var3, 2.0F * var3, 2.0F * var3);
         }
      } else {
         com.aspose.cells.b.a.b.zo var5 = com.aspose.cells.b.a.b.zo.a();
         if (this.d() == 2) {
            var5 = new com.aspose.cells.b.a.b.zo(var1.j(), var1.m());
         } else if (this.d() == 3) {
            var5 = new com.aspose.cells.b.a.b.zo(var1.l(), var1.m());
         } else if (this.d() == 0) {
            var5 = new com.aspose.cells.b.a.b.zo(var1.j(), var1.k());
         } else {
            var5 = new com.aspose.cells.b.a.b.zo(var1.l(), var1.k());
         }

         if (this.a() == 1) {
            com.aspose.cells.b.a.b.zq var6 = com.aspose.cells.b.a.b.zq.c();
            var6.a(var5.d() - var1.h());
            var6.b(var5.e() - var1.i());
            var6.c(2.0F * var1.h());
            var6.d(2.0F * var1.i());
            var2.b(var6);
         } else {
            float var7 = (float)Math.sqrt((double)(var1.h() * var1.h() + var1.i() * var1.i()));
            var2.a(var5.d() - var7, var5.e() - var7, 2.0F * var7, 2.0F * var7);
         }
      }

      return var2;
   }
}
